﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace yafc.UI.Components
{
	public partial class ListBoxItem : UserControl
	{
		private bool selected = false;

		public ListBoxItem()
		{
			InitializeComponent();
			this.DoubleBuffered = true;
		}

		public bool Selected
		{
			get { return selected; }
			set 
			{
				if (Selected != value)
				{
					selected = value; 
					Invalidate();
				}
			}
		}
		public void Select(bool Value)
		{
			if (Parent != null)
			{
				ListBox lb = Parent as ListBox;
				if (lb == null)
					return;

				lb.UnselectAll();
				if (Value)
					lb.Select(this);
			}
		}
	}
}
